//
//  JokeTableViewCell.m
//  MansApp
//
//  Created by lanou3g on 15/7/14.
//  Copyright (c) 2015年 ACH. All rights reserved.
//

#import "JokeTableViewCell.h"

@implementation JokeTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
//        self.timeLabel = [[UILabel alloc]initWithFrame:CGRectMake(kP6Height(5), kP6Height(5), kP6Height(60), kP6Height(10))];
//        self.timeLabel.text = @"今天 15:40";
//        self.timeLabel.font = [UIFont systemFontOfSize:10];
//        [self.contentView addSubview:_timeLabel];
        
        self.jokeLable = [[UILabel alloc]initWithFrame:CGRectZero];
        
        [self.contentView addSubview:_jokeLable];
        
//        self.goodView = [[UIView alloc]initWithFrame:CGRectMake(kP6Height(5), kP6Height(70),kP6Height(50), kP6Height(15))];
//        self.goodView.backgroundColor = [UIColor redColor];
//        self.goodView.layer.borderColor = [UIColor grayColor].CGColor;
//        [self.contentView addSubview:_goodView];
        
//        self.goodImageView = [[UIImageView alloc]initWithFrame:CGRectMake(kP6Height(10), 0, kP6Height(10), kP6Height(15))];
//        self.goodImageView.image = [UIImage imageNamed:@"cm2_btm_icn_music_prs.png"];
//        [self.goodView addSubview:_goodImageView];
        
//        self.goodCountLabel = [[UILabel alloc]initWithFrame:CGRectMake(kP6Height(30), 0, kP6Height(30), kP6Height(15))];
//        self.goodCountLabel.font = [UIFont systemFontOfSize:10];
//        self.goodCountLabel.text = @"250";
//        [self.contentView addSubview:_goodCountLabel];
    }
    return self;
}
- (void)cellSetModel:(JokeModel *)model
{
    
    //self.goodCountLabel.text = model.good;
    CGRect bounds = [model.content boundingRectWithSize:CGSizeMake(300, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:14] forKey:NSFontAttributeName] context:nil];
    self.jokeLable.text = model.content;
    self.jokeLable.textColor = [UIColor colorWithRed:0.213 green:0.153 blue:0.519 alpha:1.000];
    self.jokeLable.font = [UIFont fontWithName:@"Courier-BoldOblique" size:15];
    self.jokeLable.numberOfLines = 0;
    self.jokeLable.frame = CGRectMake(kP6Height(20), kP6Height(10),kWidth - kP6Height(40),bounds.size.height);
    
}


// 动态计算cell高度
+ (CGFloat)heightForCell:(JokeModel *)model
{
    CGRect bounds = [model.content boundingRectWithSize:CGSizeMake(300, 1000) options:NSStringDrawingUsesLineFragmentOrigin attributes:[NSDictionary dictionaryWithObject:[UIFont systemFontOfSize:14] forKey:NSFontAttributeName] context:nil];
    return bounds.size.height + 10 + 10;
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
